package timing.ukulele.auth.security.type.wechat;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import timing.ukulele.auth.security.ThirdTypeEnum;

import java.io.Serial;
import java.util.Collection;

public class ThirdQrAuthenticationToken extends AbstractAuthenticationToken {
    @Serial
    private static final long serialVersionUID = 500L;
    private final Object principal;
    private final ThirdTypeEnum thirdType;

    public ThirdQrAuthenticationToken(Object principal) {
        super(null);
        this.principal = principal;
        this.thirdType = null;
        this.setAuthenticated(false);
    }

    public ThirdQrAuthenticationToken(Object principal, ThirdTypeEnum thirdType) {
        super(null);
        this.principal = principal;
        this.thirdType = thirdType;
        this.setAuthenticated(false);
    }

    public ThirdQrAuthenticationToken(Object principal, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.principal = principal;
        this.thirdType = null;
        super.setAuthenticated(true);
    }

    public Object getCredentials() {
        return null;
    }

    public Object getPrincipal() {
        return this.principal;
    }

    public ThirdTypeEnum getThirdType() {
        return thirdType;
    }

}